package com.example.pharmacypick.controller;

import com.example.pharmacypick.mapper.AdministratorMapper;
import com.example.pharmacypick.pojo.Administrator;
import com.example.pharmacypick.service.AdministratorService;
import com.example.pharmacypick.utils.RespBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/administrator")
public class AdministratorController {

    @Autowired
    AdministratorService administratorService;

    //登录
    @PostMapping("/login")
    public RespBean administratorLogin(@RequestBody Administrator administrator){
        //查处的administrator
        Administrator administratorLogin = administratorService.administratorLogin(administrator);

        if(administratorLogin==null){
            return RespBean.error("error");
        }

        //只传账号
        return RespBean.success("成功",administratorLogin.getUsername());
    }

}
